-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
blobovnicza: Add benchmark to test different tree settings #2457
blobovnicza: Add benchmark to test different tree settings #2457
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2457 +/- ##
==========================================
+ Coverage 29.44% 29.46% +0.02%
==========================================
Files 399 399
Lines 30385 30392 +7
==========================================
+ Hits 8946 8955 +9
+ Misses 20696 20694 -2
Partials 743 743
... and 1 file with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Here:
But it's intended for small objects, so I've made: --- a/pkg/local_object_storage/blobstor/blobovniczatree/put_test.go
+++ b/pkg/local_object_storage/blobstor/blobovniczatree/put_test.go
@@ -47,7 +47,7 @@ func benchmarkPutMN(b *testing.B, depth, width uint64) {
nBlobovniczas *= width
}
- const objSizeLimit = 1 << 20
+ const objSizeLimit = 1 << 12
const fullSizeLimit = 100 << 20
bbcz := NewBlobovniczaTree(
@@ -66,6 +66,7 @@ func benchmarkPutMN(b *testing.B, depth, width uint64) {
RawData: make([]byte, objSizeLimit),
}
+ rand.Read(prm.RawData)
b.ReportAllocs()
b.ResetTimer()
@@ -74,7 +75,6 @@ func benchmarkPutMN(b *testing.B, depth, width uint64) {
for i := 0; i < b.N; i++ {
b.StopTimer()
prm.Address = oidtest.Address()
- rand.Read(prm.RawData)
b.StartTimer()
_, err = bbcz.Put(prm) And got:
Then
4×4 tests take noticeably more time to initialize, probably related to #2215. |
And for everyone who loves Bolt's
And now 🪄:
Which leads to
|
goos: linux goarch: amd64 pkg: github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor/blobovniczatree cpu: Intel(R) Core(TM) i5-10210U CPU @ 1.60GHz BenchmarkBlobovniczas_Put/tree=1x0-8 61 19747177 ns/op 33398 B/op 77 allocs/op BenchmarkBlobovniczas_Put/tree=10x0-8 60 18623677 ns/op 33600 B/op 77 allocs/op BenchmarkBlobovniczas_Put/tree=2x2-8 56 20861449 ns/op 36191 B/op 112 allocs/op BenchmarkBlobovniczas_Put/tree=4x4-8 43 25999988 ns/op 38511 B/op 182 allocs/op Signed-off-by: Leonard Lyubich <[email protected]>
2080185
to
cc3fb47
Compare
yep, I got excited with 1M which is default for storage node. Changed to 4K and got similar results, so updated the test
personally, i still have not had the opportunity to test the benefits of native batching in Bolt in practice, but, according to the results, its benefits are doubtful in blobovnicza tree I think we have a sufficient evidence base to try to optimize the data structure in the form of a single database with custom batching, huh? @roman-khimov @carpawell |
Want more fun? Add some threading into the mix: @@ -66,28 +67,33 @@ func benchmarkPutMN(b *testing.B, depth, width uint64) {
RawData: make([]byte, objSizeLimit),
}
+ rand.Read(prm.RawData)
b.ReportAllocs()
b.ResetTimer()
- var err error
+ var wg sync.WaitGroup
- for i := 0; i < b.N; i++ {
- b.StopTimer()
- prm.Address = oidtest.Address()
- rand.Read(prm.RawData)
- b.StartTimer()
+ var f = func(prm common.PutPrm) {
+ var err error
+ for i := 0; i < b.N; i++ {
+ prm.Address = oidtest.Address()
- _, err = bbcz.Put(prm)
+ _, err = bbcz.Put(prm)
- b.StopTimer()
- if err != nil {
- if errors.Is(err, common.ErrNoSpace) {
- break
+ if err != nil {
+ if errors.Is(err, common.ErrNoSpace) {
+ break
+ }
+ require.NoError(b, err)
}
- require.NoError(b, err)
}
- b.StartTimer()
+ wg.Done()
}
+ for j := 0; j < 20; j++ {
+ wg.Add(1)
+ go f(prm)
+ }
+ wg.Wait()
}
func BenchmarkBlobovniczas_Put(b *testing.B) { Batched:
Non-batched:
100 threads batched:
and not:
|
not really, swing in one direction or the other
i can add parallelism (as option or not) |
It's not in fact. It's very very consistent and predictable. But the point remains, bbcz tree adds zero value. |
We can add all modes, merge this one (just to save it for the future) and then take a 🔪 and do #2453. |
goos: linux goarch: amd64 pkg: github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor/blobovniczatree cpu: Intel(R) Core(TM) i5-10210U CPU @ 1.60GHz BenchmarkBlobovniczas_Put/tree=1x0_parallel-8 50 25138722 ns/op 503770 B/op 718 allocs/op BenchmarkBlobovniczas_Put/tree=10x0_parallel-8 49 24535074 ns/op 502562 B/op 723 allocs/op BenchmarkBlobovniczas_Put/tree=2x2_parallel-8 30 53013230 ns/op 630769 B/op 1748 allocs/op BenchmarkBlobovniczas_Put/tree=4x4_parallel-8 19 54977576 ns/op 762231 B/op 3308 allocs/op Signed-off-by: Leonard Lyubich <[email protected]>
added parallel runs d22c757 |
current results:
according to test, tree management doesn't really help when number of layers is small. 4x4 showed better performance which is suspicious: right now it may be expected since we didn't try to optimize working with single DB instance as described in #2453.
P.S. in current test implementation, it's not obvious do we force to switch to other DBs or not. I tried to reach this using
-benchtime=100x
where100
isfullSizeLimit/singleObjectSize
.